Skip to content

fix: per-gatherer excludeAnnotationKeysRegex now excludes resources from upload#797

Merged
SgtCoDFish merged 1 commit intomasterfrom
exclude-annotation-fix-VC-52471
May 5, 2026
Merged

fix: per-gatherer excludeAnnotationKeysRegex now excludes resources from upload#797
SgtCoDFish merged 1 commit intomasterfrom
exclude-annotation-fix-VC-52471

Conversation

@FelixPhipps
Copy link
Copy Markdown
Contributor

Fixes a bug where annotation/label-based exclusion rules had no effect on which resources were uploaded to TLSPK.

Two issues were present:

  1. The per-gatherer config fields excludeAnnotationKeysRegex and excludeLabelKeysRegex were ignored — ConfigDynamic didn't have those fields, so the YAML was discarded at parse time.
  2. Even via the top-level exclude-annotation-keys-regex, matching resources were still uploaded. The existing logic only stripped the matching keys from resource metadata (a privacy feature) — it never dropped the resource itself.

Fix: Added excludeAnnotationKeysRegex and excludeLabelKeysRegex to ConfigDynamic so per-gatherer config is correctly parsed. Added excludeResources() called in Fetch() before redactList(), which drops any resource whose annotation or label keys match the configured patterns. Both the per-gatherer and top-level config formats now work as customers expect.

Automated testing added to PR.

@FelixPhipps FelixPhipps force-pushed the exclude-annotation-fix-VC-52471 branch from 226b60a to 8459802 Compare May 5, 2026 11:43
Copy link
Copy Markdown
Contributor

@SgtCoDFish SgtCoDFish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few bits and bobs although I think really this is close!

Comment thread pkg/datagatherer/k8sdynamic/dynamic.go Outdated
Comment thread pkg/datagatherer/k8sdynamic/dynamic.go
Comment thread pkg/datagatherer/k8sdynamic/dynamic.go
Comment thread pkg/datagatherer/k8sdynamic/dynamic.go
@FelixPhipps FelixPhipps force-pushed the exclude-annotation-fix-VC-52471 branch 2 times, most recently from 3f9ccba to ef5e959 Compare May 5, 2026 14:08
@FelixPhipps FelixPhipps force-pushed the exclude-annotation-fix-VC-52471 branch from ef5e959 to 888599a Compare May 5, 2026 14:16
Copy link
Copy Markdown
Contributor

@SgtCoDFish SgtCoDFish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Thank you!

@SgtCoDFish SgtCoDFish merged commit e8270ce into master May 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants